package com.e2edour.service.bo

import java.util.Calendar
import javax.xml.bind.annotation.{XmlElement, XmlElementWrapper, XmlRootElement, XmlType}
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

import com.e2edour.service.annotation.CDataAdapter

/**
  * <p>
  *
  * @author King 
  * @since 2017/1/17
  */
class WeiXinRes extends Serializable {

  var toUserName: String = _

  @XmlElement(name = "ToUserName")
  @XmlJavaTypeAdapter(classOf[CDataAdapter])
  def getToUserName: String = {
    toUserName
  }

  def setToUserName(toUserName: String) = {
    this.toUserName = toUserName
  }

  var fromUserName: String = _

  @XmlElement(name = "FromUserName")
  @XmlJavaTypeAdapter(classOf[CDataAdapter])
  def getFromUserName: String = {
    fromUserName
  }

  def setFromUserName(fromUserName: String) = {
    this.fromUserName = fromUserName
  }

  var createTime: Long = _

  @XmlElement(name = "CreateTime")
  def getCreateTime(): Long = {
    Calendar.getInstance().getTimeInMillis()
  }

  var msgType: String = _

  @XmlElement(name = "MsgType")
  @XmlJavaTypeAdapter(classOf[CDataAdapter])
  def getMsgType: String = {
    msgType
  }

  def setMsgType(msgType: String) = {
    this.msgType = msgType
  }
}


/**
  * 文本返回类
  */
@XmlType
@XmlRootElement(name = "xml")
class WeiXinTextRes extends WeiXinRes {

  var content: String = _

  @XmlElement(name = "Content")
  @XmlJavaTypeAdapter(classOf[CDataAdapter])
  def getContent: String = {
    content
  }

  def setContent(content: String) = {
    this.content = content
  }
}

/**
  * 新闻返回类
  */
@XmlType
@XmlRootElement(name = "xml")
class WeiXinNewsRes extends WeiXinRes {

  var articleCount: java.lang.Integer = _

  @XmlElement(name = "ArticleCount")
  def getArticleCount: java.lang.Integer = {
    articleCount
  }

  def setArticleCount(content: java.lang.Integer) = {
    this.articleCount = content
  }

  var articleItems: java.util.List[WeiXinNewsItem] = _

  @XmlElementWrapper(name = "Articles")
  @XmlElement(name = "item")
  def getArticleItems(): java.util.List[WeiXinNewsItem] = {
    return articleItems
  }

  def setArticleItems(articleItems: java.util.List[WeiXinNewsItem]) {
    this.articleItems = articleItems
  }
}

class WeiXinNewsItem {

  var title: String = _

  @XmlElement(name = "Title")
  @XmlJavaTypeAdapter(classOf[CDataAdapter])
  def getTitle(): String = {
    return title
  }

  def setTitle(title: String) = {
    this.title = title
  }

  var description: String = _

  @XmlElement(name = "Description")
  @XmlJavaTypeAdapter(classOf[CDataAdapter])
  def getDescription(): String = {
    return description
  }

  def setDescription(description: String) {
    this.description = description
  }

  var picUrl: String = _

  @XmlElement(name = "PicUrl")
  @XmlJavaTypeAdapter(classOf[CDataAdapter])
  def getPicUrl(): String = {
    return picUrl
  }

  def setPicUrl(picUrl: String) = {
    this.picUrl = picUrl
  }

  var url: String = _

  @XmlElement(name = "Url")
  @XmlJavaTypeAdapter(classOf[CDataAdapter])
  def getUrl(): String = {
    return url
  }

  def setUrl(url: String) = {
    this.url = url
  }
}


